package com.flurry.android;

import android.content.Context;
import android.provider.Settings.Secure;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import com.flurry.android.responses.AppCloudError;
import java.util.UUID;

public class FlurryWallet
{
  protected static String EMAIL_END = ".flurry.com";
  private static AppCloudUser cO;
  private static Context mContext = null;

  static
  {
    cO = null;
  }

  public static void addObserverForCurrencyKey(String paramString, FlurryWalletHandler paramFlurryWalletHandler)
  {
    String str1 = et.aZ();
    String str2 = et.bd();
    if ((TextUtils.isEmpty(str1)) || (TextUtils.isEmpty(str2)))
    {
      Log.i("FlurryWallet", "There is no last logged in user");
      String str3 = generateDeviceId();
      String str4 = str3 + "@" + str3 + EMAIL_END;
      try
      {
        AppCloudUser.loginUserWithName(str3, str3, str4, true, new du(paramString, paramFlurryWalletHandler));
        return;
      }
      catch (Exception localException)
      {
        localException.printStackTrace();
        return;
      }
    }
    FlurryAppCloudRequestManager.UserSession = str2;
    AppCloudUser.setCurrentUser(et.aY());
    addObserverForUser(paramString, str1, paramFlurryWalletHandler);
  }

  protected static void addObserverForUser(String paramString1, String paramString2, FlurryWalletHandler paramFlurryWalletHandler)
  {
    if (cO == null)
      cO = et.aY();
    String str = cO.getId();
    if (TextUtils.isEmpty(str))
    {
      paramFlurryWalletHandler.onError(new AppCloudError(400, "Please assign an object id."));
      return;
    }
    r.a(str, paramString1, paramFlurryWalletHandler);
    r.b(str);
  }

  static void g(Context paramContext)
  {
    mContext = paramContext;
  }

  protected static String generateDeviceId()
  {
    TelephonyManager localTelephonyManager = (TelephonyManager)mContext.getSystemService("phone");
    String str = "" + localTelephonyManager.getDeviceId();
    return new UUID(("" + Settings.Secure.getString(mContext.getContentResolver(), "android_id")).hashCode(), str.hashCode() << 32 | "".hashCode()).toString();
  }

  public static boolean removeAllObservers()
  {
    AppCloudUser localAppCloudUser = et.aY();
    if (localAppCloudUser != null)
      return localAppCloudUser.removeAllObservers();
    return false;
  }

  public static boolean removeObserver(FlurryWalletHandler paramFlurryWalletHandler)
  {
    AppCloudUser localAppCloudUser = et.aY();
    String str;
    if (localAppCloudUser != null)
    {
      str = localAppCloudUser.getId();
      if (!TextUtils.isEmpty(str));
    }
    else
    {
      return false;
    }
    return r.a(str, paramFlurryWalletHandler);
  }

  public static boolean removeObserversForCurrencyKey(String paramString)
  {
    AppCloudUser localAppCloudUser = et.aY();
    String str;
    if (localAppCloudUser != null)
    {
      str = localAppCloudUser.getId();
      if (!TextUtils.isEmpty(str));
    }
    else
    {
      return false;
    }
    return r.a(str, paramString);
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.flurry.android.FlurryWallet
 * JD-Core Version:    0.6.2
 */